import random
r=random.randint(1,100)
print(f"{r}")
less=0
max=100
print("请输入1~100之间的整型数字")
for i in range(1,11):
    a = str(input("请输入a的值："))
    if(a.isdigit()==True and int(a)>0 and int(a)<101):
        if int(a) == r:
            print("你猜对了")
            break
        elif int(a) < r:
            print("太小了")
            a=int(a)
            if(a>less):
                less = a
            else:
                less=less
            print(f"请输入{less}到{max}之间的数字")
        elif int(a) > r:
            print("太大了")
            a=int(a)
            if (a < max):
                max = a
            else:
                max = max
            print(f"请输入{less}到{max}之间的数字")
    else:
        print("请输入1~100之间的整型数字")
print("次数已上限，退出游戏")


